/**********************************************************
 *
 * @author Rossi java@rosstauscher.de
 *********************************************************/

package de.rosstauscher.jculfw.homematic.events;

import de.rosstauscher.jculfw.homematic.HomeMaticDeviceType;

/**********************************************************
 * A raw HomeMatic message event with all it's data 
 * @author Rossi java@rosstauscher.de
 *********************************************************/

public class HomeMaticEvent {
	
	private String rawLength;
	private String rawCount;
	private String rawControlByte;
	private String rawMesssageType;
	private String rawPayLoad;
	private String sender;
	private String destination;

	/**********************************************************
	 * Constructor
	 * @param length
	 * @param count
	 * @param control
	 * @param msgType
	 * @param sender
	 * @param destination
	 * @param payLoad
	 *********************************************************/
	
	public HomeMaticEvent(String length, String count, String control, String msgType, String sender, String destination, String payLoad) {
		super();
		this.rawLength = length;
		this.rawCount = count;
		this.rawControlByte = control;
		this.rawMesssageType = msgType;
		this.sender = sender;
		this.destination = destination;
		this.rawPayLoad = payLoad;
	}

	/**********************************************************
	 * @return the rawLength
	 *********************************************************/
	
	public String getRawLength() {
		return rawLength;
	}

	/**********************************************************
	 * @return the rawCount
	 *********************************************************/
	
	public String getRawCount() {
		return rawCount;
	}

	/**********************************************************
	 * @return the rawControlByte
	 *********************************************************/
	
	public String getRawControlByte() {
		return rawControlByte;
	}

	/**********************************************************
	 * @return the rawMesssageType
	 *********************************************************/
	
	public String getRawMesssageType() {
		return rawMesssageType;
	}

	/**********************************************************
	 * @return the data
	 *********************************************************/
	
	public String getRawPayLoad() {
		return rawPayLoad;
	}
	
	/**********************************************************
	 * @return the sender
	 *********************************************************/
	
	public String getSender() {
		return sender;
	}

	/**********************************************************
	 * @return the destination
	 *********************************************************/
	
	public String getDestination() {
		return destination;
	}

	/**********************************************************
	 * @return the senderDeviceType
	 *********************************************************/
	
	public HomeMaticDeviceType getSenderDeviceType() {
		return HomeMaticDeviceType.valueOfID(this.rawMesssageType);
	}

	/**********************************************************
	 * @return the totalTelegramCount
	 *********************************************************/
	
	public int getTotalTelegramCount() {
		return Integer.parseInt(this.rawCount, 16);
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "HomeMaticEvent [rawLength=" + rawLength + ", rawCount="
				+ rawCount + ", rawControlByte=" + rawControlByte
				+ ", rawMesssageType=" + rawMesssageType + ", rawPayLoad="
				+ rawPayLoad + ", sender=" + sender + ", destination="
				+ destination + ", senderDeviceType="
				+ getSenderDeviceType() + ", totalTelegramCount="
				+ getTotalTelegramCount() + "]";
	}
	
	
	

}
